<?php
class Form_Admin extends Zend_Form
{
    public function init()
    {
        $this->setMethod('post');
        $this->setAttrib('class','frmSmall');

        // create new element
        $id = $this->createElement('hidden', 'id');
        $id->setDecorators(array('ViewHelper'));
        $this->addElement($id);

        //create the form elements
        $username = $this->createElement('text','username');
        $username->setLabel('Username: ');
        $username->setRequired('true');
        $username->addFilter('StripTags');        
        $username->addErrorMessage('The username is required!');
        $this->addElement($username);

        $password = $this->createElement('password', 'password');
        $password->setLabel('Password: ');
        $password->setRequired('true');
        $this->addElement($password);
        
        $confirm = $this->createElement('password', 'password_confirm');
        $confirm->setLabel('Confirm: ');
        $confirm->setRequired('true');
        $confirm->addValidator('PasswordConfirmation');
        $confirm->setErrorMessages(array('notMatch'=>'Password confirm is not match'));
        $this->addElement($confirm);

        $this->clearDecorators();
        $this->addDecorator('FormElements')
            //->addDecorator('HtmlTag', array())
            ->addDecorator('Description', array('class' => 'frmSmall'))            
            ->addDecorator('Form');
            
        $this->setElementDecorators(array(
            array('ViewHelper'),
            array('Errors'),
            array('Description'),
            array('Label', array('separator'=>' ')),
            array('HtmlTag', array('tag' => 'p')),
        ));
        
        $submit = $this->createElement('submit','Login');
        $submit->setDecorators(array(
            array('ViewHelper'),
            array('Description'),
            array('HtmlTag', array('tag' => 'p', 'class'=>'btn')),
        ));
        $this->addElement($submit);     
                
    }
}
?>
